﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace Shop.Web.Infrastructure.Security
{
    public class ShopAuthorizeAttribute : AuthorizeAttribute
    {
        public int PermissionID
        {
            get;
            set;
        }

        protected override bool AuthorizeCore(System.Web.HttpContextBase httpContext)
        {
            return httpContext.User != null && httpContext.User.Identity.IsAuthenticated;
            //return base.AuthorizeCore(httpContext);
        }

        protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
        {
            base.HandleUnauthorizedRequest(filterContext);
        }

        protected override System.Web.HttpValidationStatus OnCacheAuthorization(System.Web.HttpContextBase httpContext)
        {
            return base.OnCacheAuthorization(httpContext);
        }

        public override void OnAuthorization(AuthorizationContext filterContext)
        {
            base.OnAuthorization(filterContext);
        }
    }
}
